# -*- coding:utf-8 -*-

"""
@author: fanqc
@file: model.py
@time: 2023/2/15 10:31
"""
from dataclasses import dataclass
from enum import Enum


@dataclass
class Result(object):
    sort: int = None
    jd_sku_id: str = None
    excel_shop_name: str | None = None
    jd_shop_name: str | None = None
    tb_shop_name: str | None = None
    shop_similar: str | None = None

    jd_short_name: str | None = None
    jd_sku_name: str | None = None
    tb_sku_name: str | None = None

    jd_search_result: str | None = None
    tb_search_result: str | None = None
    product_similar: str | None = None
    tb_product_link: str | None = None
    jd_product_link: str | None = None
    tb_shop_link_1: str | None = None
    tb_shop_link_2: str | None = None
    jd_img: str | None = None

    def __init__(self, sort=None, jd_sku_id=None, excel_shop_name=None):
        self.sort = sort
        self.jd_sku_id = jd_sku_id
        self.excel_shop_name = excel_shop_name
        self.jd_shop_name = None
        self.tb_shop_name = None
        self.shop_similar = None

        self.jd_short_name = None
        self.jd_sku_name = None
        self.tb_sku_name = None

        self.jd_search_result = None
        self.tb_search_result = None
        self.product_similar = None
        self.tb_product_link = None
        self.jd_product_link = None
        self.tb_shop_link_1 = None
        self.tb_shop_link_2 = None
        self.jd_img = None


class ResultEnum(Enum):
    NONE_S = "淘宝无店铺"
    XIA_JIA = "京东商品已下架"
    NONE_JP = "京东无商品"
    NONE_P = "淘宝有店铺无同品"
    PERFECT_MATCH = "完美匹配到同品"
    SIMILAR_MATCH = "相似匹配到同品"
    SHU_XING = "规格属性不一致"
    ERROR = "出现异常"

    def __init__(self, desc):
        self._desc = desc

    def code(self):
        return self.name

    @property
    def desc(self):
        return self._desc
